﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using JM.JCY.BusinessEntity;
using JM.JCY.Proxy;
using Microsoft.SharePoint;

namespace JM.JCY.SharePointComponent.Department.DepartmentResposibility
{
    public partial class DepartmentResposibilityUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string currentAccount = SPContext.Current.Web.CurrentUser.Name;
            if (!IsPostBack)
            {
                if (Request.QueryString["DeptId"] != null)
                {
                    this.hfdeptId.Value = Request.QueryString["DeptId"].ToString();
                    using (UserManagementProxy proxy = new UserManagementProxy())
                    {
                        var dt = proxy.GetDeptById(Int32.Parse(this.hfdeptId.Value), string.Empty);

                        this.lblDeptName.Text = dt[0].DeptName;
                    }

                    if (currentAccount != "admin")
                    {
                        this.lkbEditResp.Visible = false;
                    }
                }
            }
        }
    }
}
